﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta name="viewport" content="width=device-width" />
    <title>添加流程信息</title>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link href="../lib/layui/css/layui.min.css" rel="stylesheet" />
    <link href="../x-admin/css/font.css" rel="stylesheet" />
    <link href="../x-admin/css/xadmin.css" rel="stylesheet" />
    <script type="text/javascript" src="../lib/Base64/base64.min.js"></script>
    <script type="text/javascript" src="../linq.js/linq.js"></script>
    <script src="../lib/cookie/cookie.js"></script>
</head>
<body>
    <div class="layui-card-body" style="">
        <form class="layui-form" name="newItem" id="newItem">
            <input type="hidden" name="stepType" id="stepType" value="1" class="layui-input">
            <input type="hidden" name="processCfgName" id="processCfgName" class="layui-input" />
            <input type="hidden" name="processType" id="processType" class="layui-input" />
            <div class="layui-form-item">
                <label style="margin-left:10px;float:left;">分组编号:</label>
                <div style="margin-left:10px;float:left;width:80%">
                    <input type="text" name="code" id="code" lay-verify="required" autocomplete="off" required value="" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label style="margin-left:10px;float:left;">备注信息:</label>
                <div style="margin-left:10px;float:left;width:80%">
                    <input type="text" id="zh_cn" name="zh_cn" lay-verify="title" autocomplete="off" required placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <a href="javascript:;" class="layui-btn" lay-submit lay-filter="save">立即提交</a>
                </div>
            </div>
        </form>
    </div>
    <script src="../lib/layui/layui.js"></script>
    <script type="text/javascript">
        function getrequest() {
            var url = location.search; //获取url中"?"符后的字串
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                }
            }
            return theRequest;
        }
        var fileName = getrequest().fileName;
        layui.$(function () {
            layui.$("#processCfgName").val(fileName);
            layui.$("#processType").val(getrequest().processType);
        })

        layui.use(['form'], function () {
            var $ = layui.$;
            var form = layui.form;
            form.on('submit(save)', function (data) {
                $.ajax({
                    type: "post",
                    url: localStorage.getItem('hosttingaddr') + "/Manager/ProcessCfgFile/addgroupitem",
                    headers: {
                        user: getCookie("userinfo"),
                        version: getCookie("version")
                    },
                    data: $('#newItem').serialize(),
                    success: function (data) {
                        if (data.code == 0) {
                            layer.msg('添加成功!', { icon: 1, time: 1000 });
                            window.parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
                            parent.layer.close(index);
                        }
                    },
                    error: function (data) {
                        layer.msg('添加失败!', { icon: 1, time: 1000 });
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
                        parent.layer.close(index);
                    }
                });
            })



        });
    </script>
</body>
</html>